package io.kiki.sba.registry.server.clientInterface.converter.pb;

import io.kiki.sba.registry.common.model.client.pb.SyncConfigRequestPb;
import io.kiki.sba.registry.core.model.SyncConfigRequest;


public class SyncConfigRequestConvertor {

    public static SyncConfigRequest convert2Java(SyncConfigRequestPb syncConfigRequestPb) {

        if (syncConfigRequestPb == null) {
            return null;
        }

        SyncConfigRequest syncConfigRequest = new SyncConfigRequest();
        syncConfigRequest.setZone(syncConfigRequestPb.getZone());
        syncConfigRequest.setDataCenter(syncConfigRequestPb.getDataCenter());

        return syncConfigRequest;
    }

    public static SyncConfigRequestPb convert2Pb(SyncConfigRequest syncConfigRequestJava) {

        if (syncConfigRequestJava == null) {
            return null;
        }

        SyncConfigRequestPb.Builder builder = SyncConfigRequestPb.newBuilder();
        builder.setZone(syncConfigRequestJava.getZone());
        builder.setDataCenter(syncConfigRequestJava.getDataCenter());

        return builder.build();
    }
}
